import MyTable from '@/components/MyTable';
import MButton from '@/components/roles/MButton';
import OrganEdit from '@/pages/Org/components/editOrgan';
import { organByList } from '@/services/org/OrganService';
import { ProColumns } from '@ant-design/pro-components';
import React from 'react';

const PageView: React.FC = () => {
  const columns: ProColumns<API.Organ>[] = [
    {
      title: '标题',
      dataIndex: 'name',
    },
    {
      title: 'Short名称',
      dataIndex: 'shortName',
    },
    {
      title: '操作',
      valueType: 'option',
      key: 'option',
      render: (text, record, _, action) => [
        // eslint-disable-next-line react/jsx-key
        <OrganEdit text={'编辑'} row={record} />,
        // eslint-disable-next-line react/jsx-key
        <MButton
          actionType={'view'}
          link={'organ/settings'}
          accessKey={'organ:index:view'}
        />,
      ],
    },
  ];
  const toolbar = [<OrganEdit text={'新增'} isCard={true} />];
  return <MyTable toolbar={toolbar} columns={columns} request={organByList} />;
};
export default PageView;
